package com.nebula.controller.salary;

import com.nebula.common.Const;
import com.nebula.controller.BaseController;
import com.nebula.service.ISalaryService;
import com.nebula.service.impl.SalaryServiceImpl;
import com.nebula.vo.UserVo;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 工资对比控制器
 *
 * @author CodeX
 * @since 2021-01-29 16:03:27
 */
@WebServlet(name = "SalaryComparisonController", urlPatterns = "/salaryComparison")
public class SalaryComparisonController extends BaseController {

    private final ISalaryService salaryService = new SalaryServiceImpl();

    public String index(HttpServletRequest request, HttpServletResponse response) {
        String navId = request.getParameter("id");
        UserVo user = (UserVo) request.getSession().getAttribute(Const.USER_INFO);
        if (salaryService.checkNavRole(user.getRoleId(), navId)) {
            return Const.FORWARD + Const.DEFAULT_URL + "salary/salary-comparison.jsp";
        } else {
            return Const.FORWARD + "role-error.jsp";
        }
    }
}
